home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / tests / gtty / foo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-23  |  691 b   |  36 lines

  1. /* 
  2.  * Short test program to verify that cross-host ioctl's work on the 
  3.  * console. 
  4.  */
  5.  
  6. #include <stdio.h>
  7. #include <sys/file.h>
  8. #include <sgtty.h>
  9.  
  10. main(argc, argv)
  11.     int argc;
  12.     char *argv[];
  13. {
  14.     int dev;            /* device to get attributes for */
  15.     struct sgttyb info;        /* attributes */
  16.  
  17.     if (argc == 1) {
  18.     dev = fileno(stdout);
  19.     } else {
  20.     dev = open(argv[1], O_RDONLY, 0);
  21.     if (dev < 0) {
  22.         perror(argv[1]);
  23.         exit(1);
  24.     }
  25.     }
  26.  
  27.     if (gtty(dev, &info) < 0) {
  28.     perror("can't get device attributes");
  29.     exit(1);
  30.     }
  31.  
  32.     printf("input speed: %d, erase: 0x%x, kill: 0x%x\n",
  33.        info.sg_ispeed, info.sg_erase, info.sg_kill);
  34.     printf("flags: 0%o\n", info.sg_flags);
  35. }
  36.